<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript">
  let user = JSON.parse(localStorage.getItem("user"));
  var brand = {
    brandName:null,
    brandStatus:null,
    createTime:null,
    createId:null,
    createName:null
  }

  $(function () {
     var time = new Date();
     $("#brandAdd_CreatName").val(user.uname);
     $("#brandAdd_CreatTime").val(time.toLocaleString());
  })

  function getPramBrandAdd(){
    brand = {
      brandName:$("#brandAdd_Name").val(),
      brandStatus:$("#brandAdd_Status").val(),
      createTime:$("#brandAdd_CreatTime").val(),
      createId:user.uid,
      createName:user.uname
    }
  }

  function addBrandOne() {
    getPramBrandAdd();
    var isTrue = confirm("确认添加吗？");
    if (isTrue === true){
      $.ajax({
        url: "/brand/addBrand",
        method: "post",
        data: brand,
        dataType: "JSON",
        success: function (rel) {
          if (rel.data === true) {
            window.location.href = "cblist";
          }
        }
      })
    }
  }

</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>品牌管理</li>
    <li>添加</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>品牌信息</span></div>
  <ul class="forminfo">
    <li>
      <label>品牌名称</label>
      <input id="brandAdd_Name" name="" type="text" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>状态</label>
      <select class="dfselect" id = "brandAdd_Status">
          <option value="1">可用</option>
          <option value="2">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input id="brandAdd_CreatName" type="text" value="马云" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input id="brandAdd_CreatTime" type="text" value="2017-11-18 15:36:10" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" value="确定" onclick="addBrandOne()"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='cblist'"/>
    </li>
  </ul>
</div>
</body>
</html>
